<template>
	<view class="content">

		<view class="u-padding-30">
			<u-search placeholder="搜索商品" v-model="initial.parm.keyword" :animation="false" bg-color="#fff"
				border-color="#333" :action-style="{color:'#818DFF',}"  :show-action="false" @custom="search" @search="search">
			</u-search>
		</view>
				
				
		
		<u-tabs :list="nav"  :current="current" @change="change"  bar-width="40"></u-tabs>
		<u-gap bg-color="#EFF0FE" height="10"></u-gap>
		
		<view class="shadow" v-if="list.length">
			<view @click="go(item)"  v-for="(item,index) in list" :ket="index" class="u-flex  u-padding-top-20 u-padding-bottom-20 u-border-bottom">
				<u-image :src="item.cover" width="100" height="100" border-radius="20"></u-image>
				<view class="u-margin-left-20">
				   <view class="u-font-lg u-font-lg u-font-weight"><text v-if="item.title">{{item.title}}</text>  <text v-if="item.goodsName">{{item.goodsName}}</text></view>
				   <view class="$u-type-info"><text v-if="item.city">{{item.city}}</text>  <text v-if="item.price">￥{{item.price}}</text></view>
				</view>
			</view>
		</view>
		
		<view class="empty" v-else>
			<u-empty mode="search"></u-empty>
		</view>
		
		<u-action-sheet :list="poupList" v-model="poupShow" @click="poupSure"></u-action-sheet>
	
	</view>
</template>

	
<script>
	import loader from '@/common/loadPage.js';
	export default {
		mixins: [loader],
		data() {
			return {
				keyword: "",
				list: [],
				initial: {
					geturl: "",
					
					parm: {
						goods_type:"",
						keyword:"",
						type:''
					},
					isPage: true
				},
				nav:[{
					name:'漫游图'
				},{
					name:'效果图'
				},{
					name:'商品'
				}],
				current:0,
				poupShow: false,
				poupInfo:'',
				poupList:[{
					text: '观看全景'
				},{
					text: '去除水印'
				}],
			}
		},
computed:{
	watchparm(){
		let {keyword}=this.initial.parm;
		let current=this.current;
		return {
			keyword,current
		}
	}
},
		watch:{
			watchparm:{
				immediate:true,
				handler(v){
					if(v.keyword ){
						switch (v.current){
							case 1:
							this.initial.geturl='/index/cases';
							this.initial.parm.type=1;
							this.initial.parm.goods_type='';
							this.getGoods()
							break;
							
							case 0:
							this.initial.geturl='/index/cases';
							this.initial.parm.type=2;
							this.initial.parm.goods_type='';
							this.getGoods()
							break;
							
							
							case 2:
							this.initial.geturl='/index/goods';
							this.initial.parm.goods_type=1;
							this.getGoods()
							break;
						}
						
					}else{
						this.list=[]
					}
				}
			}

		},
		onLoad(options) {
			if (options.keyword) {
				this.initial.parm.keyword = options.keyword
			}
			
		},
		
		methods: {
			search(e){
				this.initial.parm.keyword = e
			},
			change(e){
				this.current=e;
				
			},
			go(item){
			   switch(this.current){
				   case 1:
				   uni.navigateTo({
				   	url:'/else/designSketch/detail?id='+item.id
				   })
				   break;
				   case 0:
					   uni.navigateTo({
						url: '/pages/web/index?url=' +item.url
					   })
				   break;
				   case 2:
					   uni.navigateTo({
						url: '/pages/shop/detail?id=' +item.id
					   })
				   break;
				   
			   }
			},
			
			
		
		}
	}
</script>
<style>
	.content{
		
	}
</style>
